<script setup lang="ts">
import { onMounted} from 'vue'
import { storeToRefs } from 'pinia'
import { useLoginStore } from '@/store/login.ts'
import {getTime} from '@/utils/time'

const { getUserInfo } = useLoginStore()
const { userinfo } = storeToRefs(useLoginStore())

onMounted(() => getUserInfo())
</script>

<template>
  <div>
    <div class="card">
      <img class="img" :src="userinfo.avatar" alt="">
      <div class="sub">
        <h1>{{ getTime() }}呀{{ userinfo.name }}</h1>
        <div>刀刀甄选</div>
      </div>
    </div>

    <div class="welcome">
      <SvgIcon name="welcome" width="500px" height="350px" />
    </div>
  </div>
</template>

<style scoped lang="scss">
.card {
  display: flex;
  align-items: center;
  padding: 30px;
  box-shadow: 0 0 5px #ccc;

  .img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin-right: 20px;
  }

  .sub {
    display: flex;
    flex-direction: column;
    height: 80px;
    justify-content: space-between;

    h1 {
      font-size: 24px;
      font-weight: bold;
    }

    div {
      font-style: italic;
      color: #ccc;
    }
  }
}

.welcome {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 100px;
}
</style>